import {post, postForm} from '@/utils/http'

// 查询账单列表
export function getBillInfo(data = {}){
  // 添加默认的分页参数
  const defaultData = {
    offset: 0,
    limit: 10000,
    ...data
  }
  // 根据实际后端接口调整路径
  return post('/order/order-client/cms/bill/listAll', defaultData)
}

// 新增账单
export function createBillInfo(data) {
  return post('/order/order-client/cms/bill/insert', data)
}

// 修改账单
export function updateBillInfo(data) {
  return post('/order/order-client/cms/bill/update', data)
}

// 删除账单
export function deleteBillInfo(id) {
  return post(`/order/order-client/cms/bill/delete?id=${id}`)
}

// 批量删除账单
export function deleteBatchBillInfo(ids) {
  // ids 应该是一个字符串，包含以逗号分隔的ID列表，例如 "1,2,3"
  return post('/order/order-client/cms/bill/deleteBatch', null, {
    params: { ids }
  })
}

// 查询单个账单
export function getBillInfoById(id) {
  return post(`/order/order-client/cms/bill/get?id=${id}`)
}

//通过年份或月份获取账单
export function queryBillsByYearMonth(params) {
  return postForm('/order/order-client/cms/bill/queryByYearMonth', params);
}